{{extend 'layout.html'}}
<h1>General Report</h1>

<table>
<tr>
    <td>
        <h2>Productivity</h2>
        <ul>
            <li><b>LOC per hour:</b> {{="%0.2f" % loc_per_hour}}</li>
            <li><b>Total LOC:</b> {{=total_loc}}</li>
            <li><b>Total Time:</b> {{="%0.2f" % (total_time / 60. /60.) }} hours</li>
            <li><b>Interruption Time:</b> {{="%0.2f" % (interruption_time / 60. /60.) }} hours</li>
            <li><b>Planned Time:</b> {{="%0.2f" % (planned_time / 60. /60.) }} hours</li>
            <li><b><a title="Cost Performance Index">CPI</a>:</b> {{="%0.2f" % (cost_performance_index) }} (plan/actual time)</li>
        </ul>
    </td>
    <td>
        <h2>Defect Removal Efficiency</h2>
        <ul>
            <li><b>Process Yield:</b> {{=process_yield}} % (removal before compile)</li>
            <li><b>Defects per hour:</b> {{="%0.2f" % total_defects_injected_per_hour}} (injected/removed)</li>
            <li><b>Test Defects:</b> {{="%0.2f" % test_defects_per_kloc}} removed per KLOC</li>
            <li><b>Total Defects:</b> {{="%0.2f" % total_defects_per_kloc}} removed per KLOC</li>
            <li><b>Defect count:</b> {{=total_defect_count}}</li>
            <li><b>Fix Time:</b> {{=pretty_time(total_fix_time)}}</li>
            <li><b>Average Fix Time:</b> {{=pretty_time(average_fix_time)}}</li>
        </ul>
    </td>
    <td>
        <h2>Cost of Quality</h2>
        <ul>
            <li><b>Appraisal:</b> {{="%0.2f" % appraisal}} % (total review time)</li>
            <li><b>Failure:</b> {{="%0.2f" % failure}} % (total compile + test time)</li>
            <li><b><a title="Cost Of Quality">COQ</a>:</b> {{="%0.2f" % (appraisal + failure)}} % (appraisal + failure)</li>
            <li><b><a title="Cost Of Quality Appraisal/Failure Ratio">COQ A/FR</a>:</b> {{="%0.2f" % (appraisal_failure_ratio)}} (appraisal / failure)</li>
        </ul>
    </td>
</tr>
</table>

<h2>Report per phase</h2>
<table>
    <tr>
        <th>Phase</th>
        <th>Planned Time<br/>To Date</th>
        <th>Planned Time<br/>To Date %</th>
        <th>Actual Time<br/>To Date</th>
        <th>Actual Time<br/>To Date %</th>
        <th>Defects<br/>injected</th>
        <th>Defects<br/>removed</th>
        <th>Yield</th>
        <th>Defects<br/>per hour</th>
        <th>Defect Removal<br/>Leverage (<a title="Defect per hour (phase) / Defect per hour (test phase)">DRL</a>)</th>
    </tr>
    
    {{for phase in PSP_PHASES:}}
    <tr>
        <td>{{=phase}}</td>
        <td style="text-align: right;">{{=pretty_time(planned_time_per_phase.get(phase, 0))}} </td>
        <td style="text-align: right;">{{='%.2f' % (planned_time_per_phase.get(phase, 0) / planned_time * 100.)}} %</td>
        <td style="text-align: right;">{{=pretty_time(times_per_phase.get(phase))}}</td>
        <td style="text-align: right;">{{='%.2f' % (times_per_phase.get(phase, 0) / total_time * 100.)}} %</td>
        <td style="text-align: right;">{{='%d' % (defects_injected_per_phase.get(phase) or 0)}}</td>
        <td style="text-align: right;">{{='%d' % (defects_removed_per_phase.get(phase) or 0)}}</td>
        <td style="text-align: right;">{{=yields_per_phase.get(phase) or ''}} %</td>
        <td style="text-align: right;">{{='%.2f' % (defects_per_hour_per_phase.get(phase) or 0)}}</td>
        <td style="text-align: right;">{{='%.2f' % (defect_removal_leverage.get(phase) or 0)}}</td>
    </tr>
    {{pass}}
</table>
